package cn.iocoder.yudao.module.engine.service.core.aichat.splitter;

import cn.iocoder.yudao.module.engine.model.config.AIChatConfig;
import cn.iocoder.yudao.module.engine.service.core.aichat.splitter.impl.SemanticTextSplitter;
import org.springframework.stereotype.Component;

import jakarta.annotation.Resource;

@Component
public class TextSplitterFactory {
    @Resource
    private AIChatConfig aiChatConfig;

    public TextSplitter getService() {
        final String primary = aiChatConfig.getTextSplitter().getPrimary();
        switch (primary) {
            case "semantic":
                return new SemanticTextSplitter();
            default:
                throw new IllegalArgumentException("unknown primary:" + primary);
        }
    }
}
